From ec82f54895da4932edc67d190ccf592f219f1f01 Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Sun, 16 Oct 2005 17:25:15 +0100 Subject: [PATCH] Clean up debug tracing in mm and mm audit code. Signed-off-by: Keir Fraser --- tools/libxc/xc_linux_restore.c | 2 ++ xen/arch/x86/audit.c | 10 ---------- xen/arch/x86/mm.c | 27 +++++++++++++++++---------- 3 files changed, 19 insertions(+), 20 deletions(-) diff --git a/tools/libxc/xc_linux_restore.c b/tools/libxc/xc_linux_restore.c index 53ae53279d..2e27db651d 100644 --- a/tools/libxc/xc_linux_restore.c +++ b/tools/libxc/xc_linux_restore.c @@ -43,6 +43,8 @@ read_exact(int fd, void *buf, size_t count) while (r < count) { s = read(fd, &b[r], count - r); + if ((s == -1) && (errno == EINTR)) + continue; if (s <= 0) break; r += s; diff --git a/xen/arch/x86/audit.c b/xen/arch/x86/audit.c index 97e48ef77c..d14f105560 100644 --- a/xen/arch/x86/audit.c +++ b/xen/arch/x86/audit.c @@ -516,16 +516,6 @@ int audit_adjust_pgtables(struct domain *d, int dir, int noisy) d->domain_id, mfn, page->u.inuse.type_info); errors++; } - - if ( (page->u.inuse.type_info & PGT_pinned) != PGT_pinned ) - { - if ( !VM_ASSIST(d, VMASST_TYPE_writable_pagetables) ) - { - printk("Audit %d: L1 mfn=%lx not pinned t=%" - PRtype_info "\n", - d->domain_id, mfn, page->u.inuse.type_info); - } - } } } diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index 3554c011cf..a292bb12f9 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -366,9 +366,6 @@ static int get_page_and_type_from_pagenr(unsigned long page_nr, if ( unlikely(!get_page_type(page, type)) ) { - if ( (type & PGT_type_mask) != PGT_l1_page_table ) - MEM_LOG("Bad page type for pfn %lx (%" PRtype_info ")", - page_nr, page->u.inuse.type_info); put_page(page); return 0; } @@ -438,6 +435,7 @@ get_page_from_l1e( { unsigned long mfn = l1e_get_pfn(l1e); struct pfn_info *page = &frame_table[mfn]; + int okay; extern int domain_iomem_in_pfn(struct domain *d, unsigned long pfn); if ( !(l1e_get_flags(l1e) & _PAGE_PRESENT) ) @@ -470,9 +468,17 @@ get_page_from_l1e( d = dom_io; } - return ((l1e_get_flags(l1e) & _PAGE_RW) ? + okay = ((l1e_get_flags(l1e) & _PAGE_RW) ? get_page_and_type(page, d, PGT_writable_page) : get_page(page, d)); + if ( !okay ) + { + MEM_LOG("Error getting mfn %lx (pfn %lx) from L1 entry %" PRIpte + " for dom%d", + mfn, get_pfn_from_mfn(mfn), l1e_get_intpte(l1e), d->domain_id); + } + + return okay; } @@ -682,6 +688,7 @@ static int alloc_l1_table(struct pfn_info *page) return 1; fail: + MEM_LOG("Failure in alloc_l1_table: entry %d", i); while ( i-- > 0 ) if ( is_guest_l1_slot(i) ) put_page_from_l1e(pl1e[i], d); @@ -841,6 +848,7 @@ static int alloc_l2_table(struct pfn_info *page, unsigned long type) return 1; fail: + MEM_LOG("Failure in alloc_l2_table: entry %d", i); while ( i-- > 0 ) if ( is_guest_l2_slot(type, i) ) put_page_from_l2e(pl2e[i], pfn); @@ -1453,7 +1461,7 @@ int get_page_type(struct pfn_info *page, unsigned long type) if ( ((x & PGT_type_mask) != PGT_l2_page_table) || ((type & PGT_type_mask) != PGT_l1_page_table) ) MEM_LOG("Bad type (saw %" PRtype_info - "!= exp %" PRtype_info ") " + " != exp %" PRtype_info ") " "for mfn %lx (pfn %lx)", x, type, page_to_pfn(page), get_pfn_from_mfn(page_to_pfn(page))); @@ -1494,11 +1502,10 @@ int get_page_type(struct pfn_info *page, unsigned long type) /* Try to validate page type; drop the new reference on failure. */ if ( unlikely(!alloc_page_type(page, type)) ) { - MEM_LOG("Error while validating pfn %lx for type %" PRtype_info "." - " caf=%08x taf=%" PRtype_info, - page_to_pfn(page), type, - page->count_info, - page->u.inuse.type_info); + MEM_LOG("Error while validating mfn %lx (pfn %lx) for type %" + PRtype_info ": caf=%08x taf=%" PRtype_info, + page_to_pfn(page), get_pfn_from_mfn(page_to_pfn(page)), + type, page->count_info, page->u.inuse.type_info); /* Noone else can get a reference. We hold the only ref. */ page->u.inuse.type_info = 0; return 0; -- 2.30.2